package com.app.micaihu.view.main.game.adapter;

import com.app.micaihu.R;
import com.app.micaihu.bean.game.GameDownloadEntity;
import com.app.micaihu.configure.UmEventId;
import com.app.micaihu.custom.components.downandupload.LoadingView;
import com.app.micaihu.custom.view.CustomImageView;
import com.app.micaihu.utils.MobclickAgentUtils;
import com.app.utils.util.image.LoadImageUtils;
import com.blankj.utilcode.util.LogUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.facebook.drawee.generic.RoundingParams;

import org.jetbrains.annotations.NotNull;

/**
 * 游戏下载列表适配器
 * Created by linkai on 2017/3/14.
 */
public class GameDownloadAdapter extends BaseQuickAdapter<GameDownloadEntity, BaseViewHolder> {

    public GameDownloadAdapter() {
        super(R.layout.item_game_download);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, GameDownloadEntity item) {
        MobclickAgentUtils.event(UmEventId.game_exposed, UmEventId.INSTANCE.getMygame());
        LoadingView downloadView = (LoadingView) baseViewHolder.getView(R.id.game_download);
        downloadView.setTag(item);
        downloadView.setEventData(UmEventId.INSTANCE.getMygame());
        CustomImageView logo = (CustomImageView) baseViewHolder.getView(R.id.game_logo);
        LoadImageUtils.getInstance().loadImage(logo, item.getLogo());
        logo.getHierarchy().setRoundingParams(new RoundingParams().setCornersRadius(28.0f));

        baseViewHolder.setText(R.id.game_title, item.getName());
        baseViewHolder.setText(R.id.game_desc, item.getDescribe());
        baseViewHolder.setText(R.id.game_size, item.getAppSize());

    }


}
